package com.rsc.learningbar.controller;


import com.rsc.learningbar.entity.StudentPlan;
import com.rsc.learningbar.result.Result;
import com.rsc.learningbar.service.StudentPlanService;
import com.rsc.learningbar.vo.StudentPlanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class StudentPlanController {

    @Autowired
    StudentPlanService studentPlanService;

    /**
     * 提交答案以及插入计划
     * @param info
     * @return
     */
    @PostMapping("/addStudentPlan")
    public Result<Integer> addStudentPlan(@RequestBody StudentPlanVo info) {
        return Result.newSuccess(studentPlanService.addStudentPlan(info));
    }


    /**
     * 获取提醒数据
     * @param info
     * @return
     */
    @PostMapping("/getStudentPlan")
    public Result<StudentPlanVo> getStudentPlan(@RequestBody StudentPlanVo info) {
        return Result.newSuccess(studentPlanService.getStudentPlan(info));
    }

    /**
     * 获取成绩数据
     * @param info
     * @return
     */
    @PostMapping("/getStudentResult")
    public Result<Map<String, List<StudentPlan>>> getStudentResult(@RequestBody StudentPlanVo info) {
        return Result.newSuccess(studentPlanService.getStudentResult(info));
    }
}
